class DarkTheme:
    @staticmethod
    def apply(main_window):
        """应用黑夜主题样式表"""
        darkStyleSheet = """
            QMainWindow {
                background-color: #2b2b2b;
                color: #ffffff;
            }
            QMenuBar {
                background-color: #3c3c3c;
                color: #ffffff;
                border: 1px solid #555555;
            }
            QMenuBar::item {
                background-color: transparent;
                color: #ffffff;
                padding: 4px 10px;
            }
            QMenuBar::item:selected {
                background-color: #505050;
                color: #ffffff;
            }
            QMenu {
                background-color: #3c3c3c;
                color: #ffffff;
                border: 1px solid #555555;
            }
            QMenu::item {
                background-color: transparent;
                color: #ffffff;
                padding: 4px 20px;
            }
            QMenu::item:selected {
                background-color: #505050;
                color: #ffffff;
            }
            QToolBar {
                background-color: #3c3c3c;
                border: 1px solid #555555;
                spacing: 3px;
            }
            QToolButton {
                background-color: transparent;
                border: 1px solid transparent;
                border-radius: 3px;
                padding: 3px;
                color: #ffffff;
            }
            QToolButton:hover {
                background-color: #505050;
                border: 1px solid #777777;
            }
            QToolButton:pressed {
                background-color: #606060;
            }
            QStatusBar {
                background-color: #3c3c3c;
                color: #ffffff;
                border-top: 1px solid #555555;
            }
            QListWidget {
                background-color: #353535;
                color: #ffffff;
                border: 1px solid #555555;
                border-radius: 3px;
            }
            QListWidget::item {
                background-color: transparent;
                color: #ffffff;
                padding: 5px;
                border-bottom: 1px solid #454545;
            }
            QListWidget::item:selected {
                background-color: #505070;
                color: #ffffff;
            }
            QListWidget::item:hover {
                background-color: #404060;
            }
            QGroupBox {
                color: #ffffff;
                border: 1px solid #555555;
                border-radius: 5px;
                margin-top: 1ex;
                font-weight: bold;
                background-color: #353535;
            }
            QGroupBox::title {
                subcontrol-origin: margin;
                subcontrol-position: top center;
                padding: 0 5px;
                background-color: #353535;
            }
            QDoubleSpinBox, QSpinBox, QComboBox, QLineEdit {
                background-color: #454545;
                color: #ffffff;
                border: 1px solid #555555;
                border-radius: 3px;
                padding: 2px 5px;
            }
            QDoubleSpinBox:focus, QSpinBox:focus, QComboBox:focus, QLineEdit:focus {
                border: 1px solid #7777ff;
                background-color: #505050;
            }
            QComboBox::drop-down {
                border: none;
                width: 20px;
            }
            QComboBox::down-arrow {
                width: 12px;
                height: 12px;
            }
            QScrollBar:vertical {
                background-color: #353535;
                width: 15px;
                margin: 0px;
            }
            QScrollBar::handle:vertical {
                background-color: #606060;
                min-height: 20px;
                border-radius: 7px;
            }
            QScrollBar::handle:vertical:hover {
                background-color: #808080;
            }
            QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
                height: 0px;
            }
            QSplitter::handle {
                background-color: #505050;
            }
            QSplitter::handle:hover {
                background-color: #707070;
            }
            QLabel {
                color: #ffffff;
            }
            QCheckBox {
                color: #ffffff;
            }
            QCheckBox::indicator {
                width: 13px;
                height: 13px;
            }
            QCheckBox::indicator:unchecked {
                border: 1px solid #777777;
                background-color: #353535;
            }
            QCheckBox::indicator:checked {
                border: 1px solid #7777ff;
                background-color: #7777ff;
            }
            QPushButton {
                background-color: #505050;
                color: #ffffff;
                border: 1px solid #777777;
                border-radius: 3px;
                padding: 3px 8px;
            }
            QPushButton:hover {
                background-color: #606060;
            }
            QPushButton:pressed {
                background-color: #707070;
            }
            /* 新增音频设备管理组件样式 */
            QTabWidget::pane {
                border: 1px solid #555555;
                background-color: #353535;
            }
            
            QTabBar::tab {
                background-color: #3c3c3c;
                color: #ffffff;
                padding: 8px 16px;
                border: 1px solid #555555;
                border-bottom: none;
                border-top-left-radius: 4px;
                border-top-right-radius: 4px;
            }
            
            QTabBar::tab:selected {
                background-color: #505050;
                color: #ffffff;
            }
            
            QTabBar::tab:hover {
                background-color: #454545;
            }
            
            QTableWidget {
                background-color: #353535;
                color: #ffffff;
                border: 1px solid #555555;
                gridline-color: #555555;
                alternate-background-color: #3a3a3a;
            }
            
            QTableWidget::item {
                background-color: transparent;
                color: #ffffff;
                padding: 5px;
                border-bottom: 1px solid #454545;
            }
            
            QTableWidget::item:selected {
                background-color: #505070;
                color: #ffffff;
            }
            
            QHeaderView::section {
                background-color: #3c3c3c;
                color: #ffffff;
                padding: 5px;
                border: 1px solid #555555;
                font-weight: bold;
            }
            
            QComboBox {
                background-color: #454545;
                color: #ffffff;
                border: 1px solid #555555;
                border-radius: 3px;
                padding: 2px 5px;
            }
            
            QComboBox:focus {
                border: 1px solid #7777ff;
                background-color: #505050;
            }
            
            QComboBox::drop-down {
                border: none;
                width: 20px;
            }
            
            QComboBox::down-arrow {
                width: 12px;
                height: 12px;
            }
            
            QComboBox QAbstractItemView {
                background-color: #454545;
                color: #ffffff;
                border: 1px solid #555555;
                selection-background-color: #505070;
            }
        """
        main_window.setStyleSheet(darkStyleSheet)